/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package datos;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Ing. Monica Merlo, Ing. Agustin  Fernandez
 */
@Entity
@Table(name = "telefonoPersona")
@NamedQueries({@NamedQuery(name = "TelefonoPersona.findAll", query = "SELECT t FROM TelefonoPersona t"),
@NamedQuery(name = "TelefonoPersona.findById", query = "SELECT t FROM TelefonoPersona t WHERE t.id = :id"),
@NamedQuery(name = "TelefonoPersona.findByNumero", query = "SELECT t FROM TelefonoPersona t WHERE t.numero = :numero"),
@NamedQuery(name = "TelefonoPersona.findByDescripcion", query = "SELECT t FROM TelefonoPersona t WHERE t.descripcion = :descripcion")})
public class TelefonoPersona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "numero")
    private String numero;
    @Column(name = "descripcion")
    private String descripcion;
    @JoinColumn(name = "idPersona", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private ResponsableObra idPersona;
    @JoinColumn(name = "idTipoTelefono", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private TipoTelefono idTipoTelefono;

    public TelefonoPersona() {
    }

    public TelefonoPersona(Integer id) {
        this.id = id;
    }

    public TelefonoPersona(Integer id, String numero) {
        this.id = id;
        this.numero = numero;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNumero() {
        return numero;
    }

    public void setNumero(String numero) {
        this.numero = numero;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public ResponsableObra getIdPersona() {
        return idPersona;
    }

    public void setIdPersona(ResponsableObra idPersona) {
        this.idPersona = idPersona;
    }

    public TipoTelefono getIdTipoTelefono() {
        return idTipoTelefono;
    }

    public void setIdTipoTelefono(TipoTelefono idTipoTelefono) {
        this.idTipoTelefono = idTipoTelefono;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TelefonoPersona)) {
            return false;
        }
        TelefonoPersona other = (TelefonoPersona) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "datos.TelefonoPersona[id=" + id + "]";
    }

}
